---------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\sbstjp\OneDrive - Cardiff University\FinalHarvard\Appendix2.9.log
  log type:  text
 opened on:  12 May 2025, 19:04:58

. 
. use "C:\Users\sbstjp\OneDrive - Cardiff University\RaceIAT.public.2023.dta" // Project Implicit Demo Website 
> Datasets, Race IAT, Last Updated: 2025-02-05 09:04 PM. Date accessed: March 10, 2025. SPSS version of the dat
> aset downloaded and then, without alterations, converted to a Stata file. 

. 
. *Dropping variables makes analysis quicker
. keep politicalid7 birthyear birthSex raceomb002 edu_14 occuSelfDetail imsems1 imsems2 imsems3 imsems4 imsems5
>  imsems6 imsems7 imsems8 imsems9 imsems10 mcpr1 mcpr3 mcpr4 mcpr6 mcpr10 mcpr11 mcpr12 mcpr13 mcpr14 mcpr15 m
> cpr2 mcpr5 mcpr8 mcpr9 mcpr16

. 
end of do-file

. do "C:\Users\sbstjp\AppData\Local\Temp\STD6c9c_000000.tmp"

. // Reverse items for inclusion in scale
. local vars imsems7 mcpr2 mcpr5 mcpr8 mcpr9 mcpr16

. foreach var of local vars {
  2.     qui sum `var'
  3.     gen rev`var' = (1 + r(max)) - `var'
  4. }
(683,968 missing values generated)
(683,848 missing values generated)
(683,927 missing values generated)
(683,885 missing values generated)
(683,886 missing values generated)
(683,876 missing values generated)

. 
. // Create scale 1
. *Standardize items in the scale from 1-2 - this avoids 0, for reasons outlined in next step
. foreach var in imsems1 imsems2 imsems3 imsems4 imsems5 imsems6 revimsems7 imsems8 imsems9 imsems10 {
  2.     summarize `var'
  3.     gen s`var' = 1 + (`var' - r(min)) / (r(max) - r(min))
  4. }

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems1 |     16,781    5.168524    2.361256          1          9
(684,119 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems2 |     16,771    5.213523     2.25897          1          9
(684,129 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems3 |     16,834    6.146133    2.204677          1          9
(684,066 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems4 |     16,774    4.622988    2.337547          1          9
(684,126 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems5 |     16,812    3.859089    2.219864          1          9
(684,088 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems6 |     16,841    7.211745    2.118448          1          9
(684,059 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
  revimsems7 |     16,932    6.993799    1.944361          1          9
(683,968 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems8 |     16,879    7.149002    2.041028          1          9
(684,021 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     imsems9 |     16,946    7.039419    2.086499          1          9
(683,954 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    imsems10 |     16,867    7.043932    2.051895          1          9
(684,033 missing values generated)

. 
. * Replace missing values with 0 for the specified variables - this is necessary as Stata doesn't add up missi
> ng values
. foreach var in simsems1 simsems2 simsems3 simsems4 simsems5 simsems6 srevimsems7 simsems8 simsems9 simsems10 
> {
  2.     replace `var' = 0 if missing(`var')
  3. }
(684,119 real changes made)
(684,129 real changes made)
(684,066 real changes made)
(684,126 real changes made)
(684,088 real changes made)
(684,059 real changes made)
(683,968 real changes made)
(684,021 real changes made)
(683,954 real changes made)
(684,033 real changes made)

. 
. * Initialize the total score and the count of non-zero responses
. gen total_scoreIM = 0

. gen count_nonzeroIM = 0

. 
. * Add each variable to the total scale score and count it if non-zero
. foreach var in simsems1 simsems2 simsems3 simsems4 simsems5 simsems6 srevimsems7 simsems8 simsems9 simsems10 
> {
  2.     replace total_scoreIM = total_scoreIM + `var'
  3.     replace count_nonzeroIM = count_nonzeroIM + (`var' != 0)
  4. }
(16,781 real changes made)
(16,781 real changes made)
(16,771 real changes made)
(16,771 real changes made)
(16,834 real changes made)
(16,834 real changes made)
(16,774 real changes made)
(16,774 real changes made)
(16,812 real changes made)
(16,812 real changes made)
(16,841 real changes made)
(16,841 real changes made)
(16,932 real changes made)
(16,932 real changes made)
(16,879 real changes made)
(16,879 real changes made)
(16,946 real changes made)
(16,946 real changes made)
(16,867 real changes made)
(16,867 real changes made)

. 
. * Calculate the average score, avoiding division by zero
. gen ImsemsScale = .
(700,900 missing values generated)

. replace ImsemsScale = total_scoreIM / count_nonzeroIM if count_nonzeroIM > 0
(17,265 real changes made)

. 
. // Create scale 2
. *Standardize items in the scale from 1-2 - this avoids 0, for reasons outlined in next step
. foreach var in mcpr1 mcpr3 mcpr4 mcpr6 mcpr10 mcpr11 mcpr12 mcpr13 mcpr14 mcpr15 revmcpr2 revmcpr5 revmcpr8 r
> evmcpr9 revmcpr16 {
  2.     summarize `var'
  3.     gen s`var' = 1 + (`var' - r(min)) / (r(max) - r(min))
  4. }

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       mcpr1 |     16,938    5.200614    1.554966          1          7
(683,962 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       mcpr3 |     16,957    4.756148    1.715675          1          7
(683,943 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       mcpr4 |     16,983    2.949067    1.721803          1          7
(683,917 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       mcpr6 |     16,981    5.342029    1.565708          1          7
(683,919 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      mcpr10 |     16,910    4.448788    1.759426          1          7
(683,990 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      mcpr11 |     16,824    4.879933    1.787622          1          7
(684,076 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      mcpr12 |     16,947    5.038178    1.661704          1          7
(683,953 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      mcpr13 |     17,037    5.737043     1.48977          1          7
(683,863 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      mcpr14 |     16,931    5.455023    1.497872          1          7
(683,969 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      mcpr15 |     17,064    4.748887     1.98643          1          7
(683,836 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    revmcpr2 |     17,052    4.524279    1.740427          1          7
(683,848 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    revmcpr5 |     16,973    4.525894    1.860119          1          7
(683,927 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    revmcpr8 |     17,015    5.494857    1.643051          1          7
(683,885 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    revmcpr9 |     17,014    4.330786    1.723705          1          7
(683,886 missing values generated)

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
   revmcpr16 |     17,024    3.435444     1.75225          1          7
(683,876 missing values generated)

. 
. * Replace missing values with 0 for the specified variables - this is necessary as Stata doesn't add up missi
> ng values
. foreach var in smcpr1 smcpr3 smcpr4 smcpr6 smcpr10 smcpr11 smcpr12 smcpr13 smcpr14 smcpr15 srevmcpr2 srevmcpr
> 5 srevmcpr8 srevmcpr9 srevmcpr16 {
  2.     replace `var' = 0 if missing(`var')
  3. }
(683,962 real changes made)
(683,943 real changes made)
(683,917 real changes made)
(683,919 real changes made)
(683,990 real changes made)
(684,076 real changes made)
(683,953 real changes made)
(683,863 real changes made)
(683,969 real changes made)
(683,836 real changes made)
(683,848 real changes made)
(683,927 real changes made)
(683,885 real changes made)
(683,886 real changes made)
(683,876 real changes made)

. 
. * Initialize the total score and the count of non-zero responses
. gen total_scoreMP = 0

. gen count_nonzeroMP = 0

. 
. * Add each variable to the total scale score and count it if non-zero
. foreach var in smcpr1 smcpr3 smcpr4 smcpr6 smcpr10 smcpr11 smcpr12 smcpr13 smcpr14 smcpr15 srevmcpr2 srevmcpr
> 5 srevmcpr8 srevmcpr9 srevmcpr16 {
  2.     replace total_scoreMP = total_scoreMP + `var'
  3.     replace count_nonzeroMP = count_nonzeroMP + (`var' != 0)
  4. }
(16,938 real changes made)
(16,938 real changes made)
(16,957 real changes made)
(16,957 real changes made)
(16,983 real changes made)
(16,983 real changes made)
(16,981 real changes made)
(16,981 real changes made)
(16,910 real changes made)
(16,910 real changes made)
(16,824 real changes made)
(16,824 real changes made)
(16,947 real changes made)
(16,947 real changes made)
(17,037 real changes made)
(17,037 real changes made)
(16,931 real changes made)
(16,931 real changes made)
(17,064 real changes made)
(17,064 real changes made)
(17,052 real changes made)
(17,052 real changes made)
(16,973 real changes made)
(16,973 real changes made)
(17,015 real changes made)
(17,015 real changes made)
(17,014 real changes made)
(17,014 real changes made)
(17,024 real changes made)
(17,024 real changes made)

. 
. * Calculate the average score, avoiding division by zero
. gen McprScale = .
(700,900 missing values generated)

. replace McprScale = total_scoreMP / count_nonzeroMP if count_nonzeroMP > 0
(17,411 real changes made)

. 
. // Demographics
. *This is a convenience sample and under 18s have completed it. But we're studying voters and can drop under 1
> 8s.
. drop if birthyear>2005 
(89,040 observations deleted)

. gen age = 2023 - birthyear 

. *Drop as probably misreported age
. drop if age>100
(4,325 observations deleted)

. 
. *Rename variables and create dummies
. rename birthSex FemaleGender

. 
. gen Graduate=.
(607,535 missing values generated)

. replace Graduate=0 if inrange(edu_14, 1, 6)
(242,797 real changes made)

. replace Graduate=1 if inrange(edu_14, 7, 14)
(216,065 real changes made)

. 
. gen BIPOC=.
(607,535 missing values generated)

. replace BIPOC=0 if raceomb002==6
(84,677 real changes made)

. replace BIPOC=1 if inrange(raceomb002, 1, 5)
(27,593 real changes made)

. replace BIPOC=1 if inlist(raceomb002, 7, 8)
(16,819 real changes made)

. 
. *Sociocultural employment variable
. gen occuSelfDetail_clean = real(subinstr(occuSelfDetail, "-", "", .))
(267,100 missing values generated)

. 
. gen SocCulEmployment=.
(607,535 missing values generated)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 431000, 439000)
(17,020 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 131000, 132000)
(22,264 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 151000, 153000)
(7,973 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 171000, 173000)
(7,778 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 471000, 475000)
(3,017 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 451000, 459000)
(2,141 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 351000, 359000)
(31,451 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 371000, 373000)
(1,818 real changes made)

. 
. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 110000, 119000)
(14,948 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 551000, 553000)
(4,143 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 511000, 519000)
(2,743 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 451000, 459000)
(0 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 331000, 332000)
(497 real changes made)

. replace SocCulEmployment=0 if occuSelfDetail_clean==339000
(1,177 real changes made)

. 
. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 491000, 499000)
(1,343 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 411000, 419000)
(21,452 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 191000, 192000)
(5,341 real changes made)

. replace SocCulEmployment=0 if inrange(occuSelfDetail_clean, 531000, 537000)
(1,976 real changes made)

. replace SocCulEmployment=0 if occuSelfDetail_clean==194000
(686 real changes made)

. 
. replace SocCulEmployment=1 if inrange(occuSelfDetail_clean, 271000, 274000)
(11,346 real changes made)

. replace SocCulEmployment=1 if inrange(occuSelfDetail_clean, 251000, 259000)
(60,759 real changes made)

. replace SocCulEmployment=1 if inrange(occuSelfDetail_clean, 291000, 292000)
(15,790 real changes made)

. replace SocCulEmployment=1 if inrange(occuSelfDetail_clean, 311000, 319000)
(43,450 real changes made)

. replace SocCulEmployment=1 if inrange(occuSelfDetail_clean, 231000, 232000)
(9,252 real changes made)

. replace SocCulEmployment=1 if inrange(occuSelfDetail_clean, 391000, 399000)
(6,905 real changes made)

. replace SocCulEmployment=1 if inrange(occuSelfDetail_clean, 211000, 212000)
(19,485 real changes made)

. replace SocCulEmployment=1 if occuSelfDetail_clean==333000
(2,760 real changes made)

. replace SocCulEmployment=1 if occuSelfDetail_clean==193000
(1,468 real changes made)

. 
. // Standardize
. egen Age = std(age) 

. 
. // Create a weight
. gen weight = 1

. 
. * Code age into categories - the other variables are already in such categories
. recode age (min/24=1 "0-24") (25/34=2 "25-34") (35/44=3 "35-44") (45/54=4 "45-54") (55/max=5 "55+"), generate
> (age_group)
(607535 differences between age and age_group)

. 
. * The below are based on census data, except for ideology, which is based on data from the ANES24 pilot study
. gen sextot=.
(607,535 missing values generated)

. replace sextot = 0.49 if FemaleGender == 1 // Male
(45,494 real changes made)

. replace sextot = 0.51 if FemaleGender == 2 // Female
(87,474 real changes made)

. 
. gen agetot=.
(607,535 missing values generated)

. replace agetot = 0.12 if age_group == 1 // 18-24
(302,011 real changes made)

. replace agetot = 0.17 if age_group == 2 // 25-34
(127,817 real changes made)

. replace agetot = 0.17 if age_group == 3 // 35-44
(80,275 real changes made)

. replace agetot = 0.16 if age_group == 4 // 45-54
(55,935 real changes made)

. replace agetot = 0.38 if age_group == 5 // 55+
(41,497 real changes made)

. 
. gen idtot=.
(607,535 missing values generated)

. replace idtot = 0.08 if politicalid7 == 1 // Strongly conservative
(15,072 real changes made)

. replace idtot = 0.17 if politicalid7 == 2 // Moderately conservative
(38,393 real changes made)

. replace idtot = 0.08 if politicalid7 == 3 // Slightly conservative
(38,424 real changes made)

. replace idtot = 0.33 if politicalid7 == 4 // Neutral
(140,466 real changes made)

. replace idtot = 0.08 if politicalid7 == 5 // Slightly liberal
(51,337 real changes made)

. replace idtot = 0.18 if politicalid7 == 6 // Moderately liberal
(114,973 real changes made)

. replace idtot = 0.08 if politicalid7 == 7 // Strongly liberal
(68,862 real changes made)

. 
. gen edcats=.
(607,535 missing values generated)

. replace edcats=1 if inrange(edu_14, 1, 4) // Highschoolandbelow
(102,738 real changes made)

. replace edcats=2 if inrange(edu_14, 5, 6) // Somecollege
(140,059 real changes made)

. replace edcats=3 if edu_14==7 // Bachelors
(92,785 real changes made)

. replace edcats=4 if inrange(edu_14, 8, 14) // Graduate
(123,280 real changes made)

. 
. gen edtot=.
(607,535 missing values generated)

. replace edtot = 0.3875 if edcats == 1
(102,738 real changes made)

. replace edtot = 0.2644 if edcats == 2
(140,059 real changes made)

. replace edtot = 0.2208 if edcats == 3
(92,785 real changes made)

. replace edtot = 0.1273 if edcats == 4
(123,280 real changes made)

. 
. gen ethcats=.
(607,535 missing values generated)

. replace ethcats=1 if raceomb002==1 //AmericanIndian/AlaskaNative
(1,124 real changes made)

. replace ethcats=2 if inrange(raceomb002, 2, 3) //Asian
(10,011 real changes made)

. replace ethcats=3 if raceomb002==4 //NativeHawaiian
(828 real changes made)

. replace ethcats=4 if raceomb002==5 //Black
(15,630 real changes made)

. replace ethcats=5 if raceomb002==6 //White
(84,677 real changes made)

. replace ethcats=6 if raceomb002==7 //Other
(9,065 real changes made)

. replace ethcats=7 if raceomb002==8 //Multiracial
(7,754 real changes made)

. 
. gen ethtot=.
(607,535 missing values generated)

. replace ethtot = 0.01 if ethcats == 1
(1,124 real changes made)

. replace ethtot = 0.0599 if ethcats == 2
(10,011 real changes made)

. replace ethtot = 0.002 if ethcats == 3
(828 real changes made)

. replace ethtot = 0.1213 if ethcats == 4
(15,630 real changes made)

. replace ethtot = 0.6051 if ethcats == 5
(84,677 real changes made)

. replace ethtot = 0.0742 if ethcats == 6
(9,065 real changes made)

. replace ethtot = 0.1276 if ethcats == 7
(7,754 real changes made)

. 
. survwgt rake weight , by(FemaleGender age_group politicalid7 ethcats edcats) totvars(sextot agetot idtot etht
> ot edtot) generate(rakedweight)

. 
. // Regressions
. 
. regress ImsemsScale Age BIPOC FemaleGender Graduate SocCulEmployment [pweight=rakedweight], robust
(sum of wgt is .0241465438227219)

Linear regression                               Number of obs     =      2,882
                                                F(5, 2876)        =       3.32
                                                Prob > F          =     0.0054
                                                R-squared         =     0.1425
                                                Root MSE          =     .15487

----------------------------------------------------------------------------------
                 |               Robust
     ImsemsScale | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
             Age |   -.041012   .0169955    -2.41   0.016    -.0743367   -.0076874
           BIPOC |  -.0209094   .0168407    -1.24   0.214    -.0539304    .0121116
    FemaleGender |   .0425228   .0183648     2.32   0.021     .0065133    .0785322
        Graduate |   .0687883   .0198646     3.46   0.001     .0298379    .1077387
SocCulEmployment |  -.0092706   .0151759    -0.61   0.541    -.0390274    .0204862
           _cons |   1.547522   .0287413    53.84   0.000     1.491167    1.603878
----------------------------------------------------------------------------------

. eststo
(est1 stored)

. regress McprScale Age BIPOC FemaleGender Graduate SocCulEmployment [pweight=rakedweight], robust 
(sum of wgt is .0238475413513347)

Linear regression                               Number of obs     =      2,865
                                                F(5, 2859)        =      20.33
                                                Prob > F          =     0.0000
                                                R-squared         =     0.1396
                                                Root MSE          =     .13527

----------------------------------------------------------------------------------
                 |               Robust
       McprScale | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
             Age |   .0098659   .0044042     2.24   0.025     .0012303    .0185016
           BIPOC |   -.048733   .0108334    -4.50   0.000    -.0699752   -.0274909
    FemaleGender |   .0792019   .0114962     6.89   0.000     .0566602    .1017436
        Graduate |   .0430987   .0114869     3.75   0.000     .0205752    .0656222
SocCulEmployment |  -.0182864   .0114021    -1.60   0.109    -.0406436    .0040708
           _cons |   1.482195   .0229384    64.62   0.000     1.437218    1.527173
----------------------------------------------------------------------------------

. eststo
(est2 stored)

. esttab

--------------------------------------------
                      (1)             (2)   
              ImsemsScale       McprScale   
--------------------------------------------
Age               -0.0410*        0.00987*  
                  (-2.41)          (2.24)   

BIPOC             -0.0209         -0.0487***
                  (-1.24)         (-4.50)   

FemaleGender       0.0425*         0.0792***
                   (2.32)          (6.89)   

Graduate           0.0688***       0.0431***
                   (3.46)          (3.75)   

SocCulEmpl~t     -0.00927         -0.0183   
                  (-0.61)         (-1.60)   

_cons               1.548***        1.482***
                  (53.84)         (64.62)   
--------------------------------------------
N                    2882            2865   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. 
. log close
      name:  <unnamed>
       log:  C:\Users\sbstjp\OneDrive - Cardiff University\FinalHarvard\Appendix2.9.log
  log type:  text
 closed on:  12 May 2025, 19:07:01
---------------------------------------------------------------------------------------------------------------
